//2
function add(l1, l2) {
  const result = {};
  let p1 = l1;
  let p2 = l2;
  let cur = result;
  while (p1 != null && p2 != null) {
    cur.val = (p1.val + p2.val) % 10;
    p1 = p1.next;
    p2 = p2.next;
    if (p1 !== null && p2 !== null) {
      cur.next = {};
      cur = cur.next;
    }
  }
  while (p1 != null) {
    cur.val = p1.val;
    p1 = p1.next;
    if (p1 !== null) {
      cur.next = {};
      cur = cur.next;
    }
  }
  while (p2 != null) {
    cur.val = p2.val;
    p2 = p2.next;
    if (p2 != null) {
      cur.next = {};
      cur = cur.next;
    }
  }
}
console.log((9 + true) % 10);
